import { request } from '@/common/request'
const api = {
	login: (data : { code : string }) => {
		return request({
			data:{...data,type:'store'},
			url: '/jsWxUser/login?type=store&code='+data.code,
			method: 'post',
		})
	},
	userBindPhone: (data : any) => {
		return request({
			data:{...data,type:'store'},
			url: '/jsWxUser/userBindPhone',
			method: 'post',
		})
	},
	setUserInfo:(data : any,header?:any) => {
		return request({
			data,
			url: '/jsWxUser/updatePersonalDetails',
			method: 'put',
		},header)
	},
	findBanner: (data : any) => {
		return request({
			data,
			url: '/jsBanner/applet/findBanner?belongToPage=首页',
			method: 'get',
		})
	},
	findGoodsClassify: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findGoodsClassify',
			method: 'get',
		})
	},
	findNewestGoodsInfo: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findNewestGoodsInfo',
			method: 'get',
		})
	},
	findGoodsInfoByName: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findGoodsInfoByName',
			method: 'get',
		})
	},
	findGoodsInfoByClassify: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findGoodsInfoByClassify',
			method: 'get',
		})
	},
	findAllBrand: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findAllBrand',
			method: 'get',
		})
	},
	findGoodDetail: (data : any) => {
		return request({
			data,
			url: '/jsGoods/applet/findGoodDetail',
			method: 'get',
		})
	},
	addShoppingCart: (data : any) => {
		return request({
			data,
			url: '/jsShoppingCart/addShoppingCart',
			method: 'post',
		})
	},
	
	findShoppingCart:(data : any) => {
		return request({
			data,
			url: '/jsShoppingCart/findShoppingCart',
			method: 'get',
		})
	},
	removeShoppingCart:(id : any) => {
		return request({
			url: `/jsShoppingCart/removeShoppingCart/${id}`,
			method: 'delete',
		})
	},
	getAddrList:(data?:any) => {
		return request({
			data,
			url: '/jsUserAddress/getUserAddressPage',
			method: 'get',
		})
	},
	saveOrUpdateAddr:(data:any) => {
		return request({
			data,
			url: '/jsUserAddress/saveOrUpdate',
			method: 'post',
		})
	},
	delAddr:(id : any) => {
		return request({
			url: `/jsUserAddress/removeById/${id}`,
			method: 'delete',
		})
	},
	findHotWord:()=>{
		return request({
			url: '/jsHotWord/applet/findHotWord',
			method: 'get',
		})
	},
	placeAnOrder: (data : any) => {
		return request({
			data,
			url: '/jsOrderInfo/applet/placeAnOrder',
			method: 'post',
		})
	},
	findUserOrderInfo:(data?:any) => {
		return request({
			data,
			url: '/jsOrderInfo/applet/findUserOrderInfo',
			method: 'get',
		})
	},
	findOrderDetailsInfo:(id:string) => {
		return request({
			url: `/jsOrderInfo/applet/findOrderDetailsInfo?orderId=${id}`,
			method: 'get',
		})
	},
	cancelOrder: (data : any) => {
		return request({
			data,
			url: '/jsOrderInfo/applet/cancelOrder',
			method: 'post',
		})
	},
	findAvailableCoupons: (data : any) => {
		return request({
			data,
			url: '/jsCoupon/applet/findAvailableCoupons',
			method: 'post',
		})
	},
	findUserCouponList:(data:any) => {
		return request({
			data,
			url: `/jsCoupon/applet/findUserCouponList`,
			method: 'get',
		})
	},
	findCouponDetail:(couponId:string) => {
		return request({
			url: `/jsCoupon/applet/findCouponDetail?couponId=${couponId}`,
			method: 'get',
		})
	},
	findUsableGoodsByCouponId:(data:any) => {
		return request({
			data,
			url: `/jsCoupon/applet/findUsableGoodsByCouponId`,
			method: 'get',
		})
	},
	getPayRes:(data:any) => {
		return request({
			data,
			url: `/wxPay/pay?orderNo=${data.orderNo}`,
			method: 'post',
		})
	},
	affirmProfile:(data:any) => {
		return request({
			data,
			url: `/jsOrderInfo/applet/affirmProfile`,
			method: 'post',
		})
	},
	applyRefund:(data:any) => {
		return request({
			data,
			url: `/jsRefundApplication/applet/applyRefund`,
			method: 'post',
		})
	},
	fillReturnLogistics:(data:any) => {
		return request({
			data,
			url: `/jsRefundApplication/applet/fillReturnLogistics`,
			method: 'post',
		})
	},
}
export default api